<?php

class myUser extends sfBasicSecurityUser
{
    
    public function __construct(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array()) {
        parent::__construct($dispatcher, $storage, $options);
        $this->setAttribute('menu', new menu(menu::HOME));
    }
    public function getMenu() {
        return $this->getAttribute('menu');
    }
    public function setPerson(Person $person = null) {
        if ($person == null) {
            $this->getAttributeHolder()->remove('person');
        } else {
            $this->setAttribute('person', $person);
        }
    }
    public function getPerson() {
        return $this->getAttribute('person');
    }
    public function getLogin() {
        return $this->getPerson()->getLevel();
    }
    public function getLevel() {
        return $this->getPerson()->getLogin();
    }
    public function __toString() {
        $ret = 'myUser(';
        if ($this->getMenu() != null) {
            $ret += $this->getMenu()->__toString();
        }
        $ret += ',';
        if ($this->getPerson() != null) {
            $ret += $this->getPerson()->__toString();
        }
        $ret += ')';
        return $ret;
    }
}
